export const deepClone = (obj: any, result: any) => {
  var result = result || {};

  for (var prop in obj) {
    if (obj.hasOwnProperty(prop)) {
      if (typeof obj[prop] == 'object' && obj[prop] !== null) {
        // 引用值(obj/array)且不为null

        if (Object.prototype.toString.call(obj[prop]) == '[object Object]') {
          // 对象

          result[prop] = {};
        } else {
          // 数组

          result[prop] = [];
        }

        deepClone(obj[prop], result[prop]);
      } else {
        // 原始值或func

        result[prop] = obj[prop];
      }
    }
  }

  return result;
};
